package com.yequan.designpattern.observer.wechat;

/**
 * @author yequan
 * @date 2019/12/12
 */
public class TestObserver {

    public static void main(String[] args) {
        WechatServer wechatServer = new WechatServer();

        User userLi = new User("李白");
        User userDu = new User("杜甫");
        User userWang = new User("王安石");

        wechatServer.registerObserver(userLi);
        wechatServer.registerObserver(userDu);
        wechatServer.registerObserver(userWang);

        wechatServer.setInfo("李白的诗最好");

        System.out.println("******王安石收到消息后很生气,取关了******");

        wechatServer.removeObserver(userWang);

        wechatServer.setInfo("杜甫的诗最好");

    }

}
